<?php	 
	//Singleton class responsible for handing interactions with the database
	class dbHandler {
		private static $instance;
		private	$dbname = "riabough";
		private $dbserver = "dbs4.cpsc.ucalgary.ca";
		private $dbuser = "riabough";
		private $dbpassword = "10013266";
		
		public static function getInstance() 
		{
			if(self::$instance == null)
				self::$instance = new dbHandler();
			return self::$instance;
		}
		private function __construct()
		{
			$this->connect();
		}
		private function connect() 
		{
			$connect = mysql_connect($this->dbserver, $this->dbuser, $this->dbpassword);	
			mysql_select_db($this->dbname, $connect);
		}
		
		public function query($str)
		{
			$result = mysql_query($str);
			if (!$result)
			    die('Invalid query: ' . mysql_error());
			return $result;
		}
	}
?>